package com.atguigu.gmall.publisher.mapper;

import com.atguigu.gmall.publisher.beans.VisitorStats;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Author: Felix
 * Date: 2022/1/10
 * Desc: 访客主题统计Mapper接口
 */
public interface VisitorStatsMapper {

    @Select("select is_new,sum(uv_ct) uv_ct,sum(pv_ct) pv_ct,sum(sv_ct) sv_ct, sum(uj_ct) uj_ct,sum(dur_sum) dur_sum from visitor_stats_0701 where toYYYYMMDD(stt)=#{date} group by  is_new")
    List<VisitorStats> selectVisitorStatsByIsnew(Integer date);


    @Select("select toHour(stt) hr,sum(visitor_stats_0701.uv_ct) uv_ct, sum(pv_ct) pv_ct, sum(if(is_new='1', visitor_stats_0701.uv_ct,0)) new_uv " +
        " from visitor_stats_0701 where toYYYYMMDD(stt)=#{date} group by hr")
    List<VisitorStats> selectVisitorStatsByHr(Integer date);


}
